const EssayModel = require('../do/models/essay');
class EssayService {
    async getEssay(data){
        const {id} = data;
        if(!id){
            return await EssayModel.findAll();
        }
        return await EssayModel.findOne({
            where:{id}
        })
    }
    async createEssay(data){
        return await EssayModel.create({data});
    }
    async destroyEssay(id){
        return await EssayModel.destroy({
            where:{
                id
            }
        })
        
    }
    async updateEssay(id,data){
        return await EssayModel.update({
            data
        },{
            where:{
                id
            }
        })
    }
    async 
} 
module.exports = new EssayService();